package com.wang.commons.result;

public class Result {

    private boolean success;

    private String code;

    private String message;

    private Object data;

    public Result() {
    }

    public Result(boolean success, String code, String message, Object data) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static Result success(){
        return success(null);
    }

    public static Result success(Object data){
        return success("EXECUTE_SUCCESS","执行成功",data);
    }

    public static Result success(String code,String message,Object data){
        return new Result(true,code,message,data);
    }

    public static Result fail(){
        return fail("执行失败");
    }

    public static Result fail(String message){
        return fail("EXECUTE_FAIL",message);
    }

    public static Result fail(String code,String message){
        return new Result(false,code,message,null);
    }


    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
